<!-- Copyright 2010 John L. Reilly

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.   -->

<%@ page import="java.util.List"%>
<%@ page import="java.util.ArrayList"%>
<%@ page import="com.riq.entity.Icon"%>
<%@ page import="com.riq.entity.Marker"%>
<%@ page import="com.riq.entity.Department"%>
<%@ page import="com.riq.ServletUtilities"%>
<%@ page import="java.io.IOException"%>
<%@ page import="java.net.MalformedURLException"%>
<%@ page import="java.net.URL"%>
<%@ page import="java.io.BufferedReader"%>
<%@ page import="java.io.InputStreamReader"%>
<%@ page import="java.io.IOException"%>

<%
Long timeStamp = System.currentTimeMillis();
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>FirstResponder</title>

<!--META-->
<meta http-equiv="content-type"  content="text/html; charset=utf-8"/>
<meta name="viewport" content="width=device-width" />

<!--STYLESHEET-->
<link rel="stylesheet" type="text/css" href="stylesheets/static.css" />

<%

  String deptId = (String) request.getAttribute("deptId");
  System.out.println("1: " + deptId);

  String memberId = (String) request.getAttribute("memberId");
  System.out.println("2: " + memberId);

  String startLat = (String) request.getAttribute("startLat");
  System.out.println("3: " + startLat);

  String startLng = (String) request.getAttribute("startLng");
  System.out.println("4: " + startLng);

  String size = (String) request.getAttribute("size");
  System.out.println("5: " + size);

  Object urlRoot = (Object) request.getAttribute("urlRoot");
  System.out.println("6: " + urlRoot);

  List<Icon> icons = (List<Icon>) request.getAttribute("icons");
  System.out.println("7: " + icons.size());
  
%>

<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">

var deptLayer =  null;
var map;
var marker;

function initialize() {
     var myLatlng = new google.maps.LatLng(<%=startLat%>,<%=startLng%>);
     var myOptions = {
       zoom: 18,
       center: myLatlng,
       mapTypeId: google.maps.MapTypeId.HYBRID
     }  

    var timestamp = new Date().getTime();
    var deptURL = "http://responderiq05.appspot.com/marker?action=kml&time=23423423";
    
    map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
    deptLayer = new google.maps.KmlLayer(deptURL, { map: map, preserveViewport: true });

    google.maps.event.addListener(map, 'click', function(event) {
        placeMarker(event.latLng);
    });
}

function toggleHydrants() {
  if (show_hydrants == 1)
  {
    show_hydrants = 0;
    hydrantsLayer.setMap(null);  
  }
  else
  {
    show_hydrants = 1; 
    hydrantsLayer.setMap(map);    
  }
}

</script>
</head>

<body onload="initialize()">

<!--FIXED HEADERS-->
<div class="headwrap">
<div class="hBlack">
<div class="headerLeftTop">FirstResponder</div>
<div class="headerRightTop">ver 0.9</div>
<div class="headerLeftBottom">Pre-Plan: Map</div>
<div class="headerRightBottom">12:34 PM</div>
</div>
<div class="hGray">
  <a class="buttonGrayHdr" href="mainMenu.html">Main</a>
  <a class="buttonGrayHdr" href="commandMenu.html">Command</a>
  <a class="buttonGrayHdr gSelected" href="department?action=display">Admin</a>
</div>
<div class="headerMist"></div>
</div>

<div class="outwrap" style="max-width: 260px">
<div class="headerPlug"></div>

<!--BUTTONS-->

<div id="centeredButtons"><ul><li>
<a class="button blue narrow tall first"
   href="commandMenu.html">Back</a></li></ul>
</div>

<!--CONTENT-->
<div class="sub white" style="width: 100%">Toggle Layers</div> 
<div class="row">
<div class="row" style="width: 100%">
         <input id="1" type="checkbox" name="memberId" 
         style="margin-right: 10px" value="Structure"/>
        Structure</div>

<div class="row" style="width: 100%">
         <input id="1" type="checkbox" name="memberId" 
         style="margin-right: 10px" value="Structure"/>
        Apparatus</div>
        
<div class="row" style="width: 100%">
         <input id="1" type="checkbox" name="memberId" 
         style="margin-right: 10px" value="Personnel"/>
        Personnel</div>
</div>

<!--FOOTER-->
<div class="footer" style="margin-right: 10px">jreilly</div>

<!--OUTLINE WRAPPER -->
</div> 

<div class="mapWrapper" style="width: 100%; left: 260px; top: 115px; 
     position: absolute; clear: none; padding: 10px;">
<div style="height: 1000px; width: 100%; clear:left; float: left" id="map_canvas"></div>
</div>

</form>

</body>
</html>